package bb.lanxing.lib.devices.core.provider;

import bb.lanxing.lib.devices.api.provider.DataProvider;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;

abstract class AbsDataProvider<INTERFACE> implements DataProvider<INTERFACE> {
    protected final Set<INTERFACE> mListeners = Collections.synchronizedSet(new LinkedHashSet());

    @Override
    public void registerDataListener(INTERFACE r2) {
        if (r2 == null) {
            return;
        }
        this.mListeners.add(r2);
    }

    @Override
    public void unregisterDataListener(INTERFACE r2) {
        if (r2 == null) {
            return;
        }
        this.mListeners.remove(r2);
    }

    public void release() {
        this.mListeners.clear();
    }
}
